package com.hup.winHolderService.framework.exception;

import com.hup.winHolderService.framework.model.ExceptionResult.BaseResultException;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;

/**
 * msg=服务器异常
 * 不给用户看的异常消息
 * {@link HttpStatus#INTERNAL_SERVER_ERROR}
 *
 * @author hugan
 * @date 2023/7/9
 */
@Slf4j
public class AppServerException extends RuntimeException implements BaseResultException {
    @Getter
    private HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;

    public AppServerException(String message) {
        super(message);
    }

    public AppServerException(String message, Throwable e) {
        super(message, e);
    }

    @Override
    public String getRespMessage() {
        return "服务器异常";
    }

    @Override
    public void doLog() {
        log.error(AppLogger.getStack(getMessage(), getCause() == null ? this : getCause()));
    }

}
